import request from '@/utils/request'

// 查询库存列表
export function listInventory(query) {
  return request({
    url: '/api/inventory/list',
    method: 'get',
    params: query
  })
}

// 查询库存预警列表
export function listAlert() {
  return request({
    url: '/api/inventory/alert',
    method: 'get'
  })
}

// 根据商品ID和仓库ID查询库存详情
export function getInventory(productId, warehouseId) {
  return request({
    url: '/api/inventory/detail',
    method: 'get',
    params: { productId, warehouseId }
  })
}

// 商品入库
export function stockIn(data) {
  return request({
    url: '/api/inventory/stockIn',
    method: 'post',
    data: data
  })
}

// 商品出库
export function stockOut(data) {
  return request({
    url: '/api/inventory/stockOut',
    method: 'post',
    data: data
  })
}

// 库存调整
export function adjustStock(data) {
  return request({
    url: '/api/inventory/adjust',
    method: 'post',
    data: data
  })
}

// 设置预警阈值
export function setAlertThreshold(data) {
  return request({
    url: '/api/inventory/setAlert',
    method: 'put',
    data: data
  })
}
